home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48_1 / nfaphp48 < prev    next >
Text File  |  1995-03-31  |  18KB  |  825 lines

  1.  
  2.  
  3. NFAP (c) 1990
  4. All rights Reserved
  5. Don C Robinson
  6. 3812 Booth
  7. Kansas City, KS 66103
  8. (913)362-3969 Home
  9. (816)854-5434 Work
  10.  
  11. This program is provided free of charge and can be distributed under the follow:
  12.  
  13. 1)  It is distributed unaltered, complete with document file included.
  14. 2)  Also it has to be given freely.  No charge or distribution fee, may be coll.
  15.  
  16. 3)  If used for commercial use, the company should contact me directly for perm.
  17.  
  18. The reason for the above distribution rules is simple.  I provided the program .
  19.  
  20. NFAP - Nodal Format Analysis Program
  21. for calculating the voltages of an AC Electronics Circuit using descrete compon.
  22.  
  23. Program overview:
  24.  
  25. Variables Used:
  26.  
  27. N= Number Nodes
  28. F= Frequency
  29.  
  30. Three complex matrices are used:
  31.  
  32. A= N by N complex matrix, contains device loads
  33. B= N by 1 complex matrix, contains current sources
  34. C= N by 1 complex matrix, is the unknown voltages matrix
  35.  
  36. B=A*C
  37.  
  38. C=B/A   To find the solution
  39.  
  40. Devices are added into the matrices as using the following formulas:
  41.  
  42. Resistor:   R ohms
  43.  
  44.                   -> Ix
  45.   O-------------\/\/\/\/\-------------O
  46. Node From                          Node To
  47.  
  48. m=1/R+0j
  49.  
  50. Capacitor:   C farads
  51.  
  52.                   -> Ix
  53.   O-----------------|(----------------O
  54. Node From                          Node To
  55.  
  56. m=0+2(pi)C(freq)j
  57.  
  58.  
  59. Inductor:  L Henry
  60.                   -> Ix
  61.   O-----------------[Z]---------------O
  62. Node From                          Node To
  63.  
  64. m=0+-1/(2(pi)L(freq))j
  65.  
  66.  
  67. R+xj:  R ohms + x=(L) Henry
  68.                   -> Ix
  69.   O-------\/\/\/\/\/\------[Z]--------O
  70. Node From                          Node To
  71.  
  72. m=1/R+-1/(2(pi)L(freq))j
  73.  
  74.  
  75.  
  76. Complex Value (m) is added or subtracted into matrix A as follows:
  77.  
  78. ------------------------------------------------------------
  79. Matrix A Row/Column |----------------Column----------------|
  80. --------Row---------|  Node Leaving     |    Node Entering |
  81. --------------------|-------------------|------------------|
  82. Node Leaving+ (From)|       +m          |        -m        |
  83. Node Entering+ (To) |       -m          |        +m        |
  84. ------------------------------------------------------------
  85.  
  86.  
  87. Current Source:  I Angle Theta
  88.  
  89.                   -> Ix
  90.   O----------------(->)--------------O
  91. Node From           I              Node To
  92.  
  93. ------------------------------------------
  94. Matrix B Row        |One dimension matrix|
  95. --------Row---------|----Column one------|
  96. --------------------|--------------------|
  97. Node Leaving+ (From)|       -I           |
  98. Node Entering+ (To) |       +I           |
  99. ------------------------------------------
  100.  
  101.  
  102. Vs+R
  103. Voltage Source with Resistor in series:  E Volts, R ohms
  104.  
  105. I=E/R
  106.  
  107. Add I the same as a current source and add R same as a resistor.
  108.  
  109. IcIs
  110. Current Controlled Current Source: 
  111.  
  112. Node Leaving       Node Leaving
  113. Control side       Source Side
  114. _______            _______
  115.    +  |            |   +
  116.       \            |
  117.       /            |   |
  118.  R    \ Ib        (I)  V I=B*Ib        B=Beta=Control Value
  119.       /            |                   Ib=Current through R
  120.       \            |
  121.    -  |            |   -
  122. -------            -------
  123. Node Entering      Node Entering
  124. Control Side       Source Side
  125.  
  126. m=B/r        B=Control Value
  127.  
  128. Add m to Matrix A as follows and then add R to Matrix A same as a resistor.
  129.  
  130. ------------------------------------------------------------
  131. Matrix A Row/Column |----------------Column----------------|
  132. --------Row---------|              Source Nodes            |
  133. ----Control Nodes---|  Node Leaving     |    Node Entering |
  134. --------------------|-------------------|------------------|
  135. Node Leaving+ (From)|       +m          |        -m        |
  136. Node Entering+ (To) |       -m          |        +m        |
  137. ------------------------------------------------------------
  138.  
  139. VcIs
  140. Voltage Controlled Current Source: 
  141.  
  142. Node Leaving       Node Leaving
  143. Control side       Source Side
  144. _______            _______
  145.    +  |            |   +
  146.       \            |
  147.       /            |   
  148.  R    \ Vx        (I)     I=gm(Vx)    gm=Control factor
  149.       /            |                  Vx=Voltage across R
  150.       \            |
  151.    -  |            |   -
  152. -------            -------
  153. Node Entering      Node Entering
  154. Control Side       Source Side
  155.  
  156. Add Control factor to matrix A as follows:
  157.  
  158. ------------------------------------------------------------
  159. Matrix A Row/Column |----------------Column----------------|
  160. --------Row---------|              Source Nodes            |
  161. ----Control Nodes---|  Node Leaving     |    Node Entering |
  162. --------------------|-------------------|------------------|
  163. Node Leaving+ (From)|       +gm         |       -gm        |
  164. Node Entering+ (To) |       -gm         |       +gm        |
  165. ------------------------------------------------------------
  166.  
  167.  
  168.  
  169. Routines to NFAP for HP-48SX
  170.  
  171.  
  172. Name     Description
  173. -------- ---------------------------------------------------
  174. Begin    Starts/Restarts program for AC Circuit Analysis.
  175. DELv     Purges all variables created by NFAP
  176. Solv     Solves for Voltages unknown and displays them in stk
  177. VcIs     Adds variables for Voltage Controlled I Source
  178. R&Xj     Adds variables for R+Xj device
  179. Branch   Subroutine that asks for Next Device
  180. From     Subroutine that asks for From and To nodes.
  181. Brn      Creates 'Dev' = Branch # + Device Type
  182. Offm     Blanks Custom menus
  183. Menu     Turns on Custom menus
  184. Resis    Adds variables for Resistor Device
  185. Cap      Adds variables for Capacitor Device
  186. Inductor Adds variables for Inductor Device
  187. Is       Adds variables for Current Source
  188. Vs&R     Adds variables for Voltage Source + series Resistor
  189. IcIs     Adds variables for Current Controlled Current Source
  190. Add      Adds X to Matrix A using Fr and To for columns/Rows
  191. Add2     Adds X to Matrix B using Fr and To for Rows
  192. Add3     Adds X to Matrix A using Fr,Fr2,To,To2 for col/Rows
  193. LblD     Adds Device value + label to 'Dev' variable
  194. LblF     Adds Fr and To to 'Dev' variable
  195. LblG     Adds Fr2 and To2 to 'Dev' variable
  196. Copyright Copyright message for NFAP
  197.  
  198. Variables Used:
  199.  
  200. Name     Description
  201. -------- ----------------------------------------------------
  202. N        Number of Nodes in circuit
  203. F        Frequency in Hz
  204. A        Matrix A - N by N complex matrix
  205. B        Matrix B - N by 1 complex matrix
  206. C        Matrix C - N by 1 complex Matrix
  207. Bn       Branch number (Number of Devices)
  208. Dev      Last Device/Current Device specs, helps keep track
  209.          of data entry.
  210. CST      Custom Menu list
  211. X        Complex variable used to add device to matrix
  212. Fr       From Node
  213. To       To Node
  214. Fr2      From Node (control device)
  215. To2      To Node (control device)
  216. Y        Complex Variable - Used when two devices are added.
  217. -------------------------------------------------------------
  218.  
  219. Custom menu
  220.  
  221.         [Resis]  [ Cap ]  [Induc]  [ Is  ]  [VS&R ]  [ICIS ]
  222. NXT ->  [VCIS ]  [R&XJ ]  [SOLV ]  [BEGIN]  [DELV ]  [     ]
  223.  
  224. -------------------------------------------------------------
  225.  
  226. Running the program:
  227.  
  228. 1) Go into NFAP Directory
  229.  
  230. 2) Press [BEGIN] to Start or Restart the program.
  231.  
  232. 3)Enter number of Nodes in Circuit, exclude reference node.
  233.  
  234. 4)  Enter Frequency
  235.  
  236. 5) When prompted for Next Branch, select device from softkeys.  For example if .
  237.  
  238. 6)  Repeat step 5 for each device in the circuit.
  239.  
  240. 7)  Select [SOLV] from the second level of softkeys to solve the matrix for the.
  241.  
  242. 8)  If your ready to begin another circuit go to step 2, If your ready to exit .
  243.  
  244. The end.
  245.  
  246. Now for an example:
  247.  
  248.  
  249. Circuit:
  250.  
  251.    [ Node 1            ]     R2    [Node 2]    R3    [Node 3]
  252.    [-------------------]--\/\/\/\/-[------]-\/\/\/\/-[------]
  253.     |       |       |      4 ohms    |       3 ohms        |
  254.     I    R1 \       )                |                     )
  255. Is (^)   1  /       ) Inductor       | Capacitor           )
  256. 1<60|   Meg \       ) .3 h           = 1 uf           .2 h )
  257.     |   ohm /       )                |            Inductor )
  258.     |       |       |                |                     |
  259.    [--------------------------------------------------------]
  260.    [                   Reference Node                       ]
  261.  
  262.  
  263. Start Program
  264.  
  265. [Begin]
  266. |----------------------|
  267. |     NFAP (c) 1990    |
  268. |                      |
  269. |     Nodal Format     |
  270. |   Analysis Program   |
  271. |                      |
  272. |   By Don Robinson    |
  273. |                      |
  274. |[ ] [ ] [ ] [ ] [ ][ ]|
  275. |----------------------|
  276.  
  277. |----------------------|
  278. |                      |
  279. | Number Nodes?        |
  280. |                      |
  281. |                      |
  282. | <                    |
  283. |[ ] [ ] [ ] [ ] [ ][ ]|
  284. |----------------------|
  285.  
  286. Circuit has three nodes and a reference node.
  287.  
  288. Type
  289.           3 [ENTER]
  290.  
  291. |----------------------|
  292. |                      |
  293. | Frequency Hz?        |
  294. |                      |
  295. |                      |
  296. | <                    |
  297. |[ ] [ ] [ ] [ ] [ ][ ]|
  298. |----------------------|
  299.  
  300.  
  301. Analysis the Circuit at 10,000 Hz
  302.  
  303. Type
  304.           10000 [ENTER]
  305.  
  306. |----------------------|
  307. |     NFAP (c) 1990    |
  308. |Last: NONE            |
  309. |                      |
  310. |                      |
  311. |  Branch Number 1 ?   |
  312. |                      |
  313. |   (Select Device)    |
  314. |[B] [C] [L] [I][V][IC]|
  315. |----------------------|
  316.  
  317. Enter the current source.
  318.  
  319. Press Softkey 
  320.           [ IS ]
  321.  
  322. |----------------------|
  323. |Br=1 I<O              |        I<O=I Angle Theta
  324. |                      |
  325. |Current Source I<O?   |        I<O=I Angle Theta
  326. |                      |
  327. | <                    |
  328. |[ ] [ ] [ ] [ ] [ ][ ]|
  329. |----------------------|
  330.  
  331. Since the current source is a complex number 1 amp at phase 60 degrees.  Enter r
  332.  
  333. Press
  334.           [Shift Left] ()
  335. Next enter complex number
  336.           1 [Shift Right] [Angle Symbol] 60
  337.  
  338. So it looks something like
  339. (1<60)                         < = Angle Symbol
  340.  
  341. Then type
  342.           [ENTER]
  343.  
  344. |----------------------|
  345. |Br=1 I<O              |      I<O=I Angle Theta
  346. |(1<60) :              |      Depends on Display Mode XYZ,R<Z
  347. |Node L+.E-?           |
  348. |                      |
  349. | <                    |
  350. |[ ] [ ] [ ] [ ] [ ][ ]|
  351. |----------------------|
  352.  
  353.  
  354. Nodes L+.E-?
  355. L=Leaving or From or +, and E=Entering or To or -.
  356.  
  357. The current source is Leaving node 0 and Entering Node 1.
  358.  
  359. Type in
  360.           0.1 [ENTER]
  361. or type in
  362.           .1 [ENTER]
  363.  
  364. The program will flash that it is adding the current source into the matrix and.
  365.  
  366. |----------------------|
  367. |     NFAP (c) 1990    |
  368. |Last: Br=1 I<O        |  Last device entered Branch 1, IS
  369. |(I<60) :0:1           |  1 amp 60 deg  from node 0 to 1
  370. |                      |
  371. |  Branch Number 2 ?   |
  372. |                      |
  373. |   (Select Device)    |
  374. |[B] [C] [L] [I][V][IC]|
  375. |----------------------|
  376.  
  377.  
  378. Select
  379.           [Resis]
  380.  
  381. Resistance Value ohms?
  382. Type
  383.           1 [EEX] 6 [ENTER]
  384. Nodes L+.E-?
  385. Type
  386.           1 [ENTER]
  387.  
  388. Doesn't matter on Resistor, Capacitor, Inductor or R=Xj what node goes in firstS
  389. In the above case, any of the following inputs can be used:
  390.           1 [ENTER]
  391.           1.0 [ENTER]
  392.           .1 [ENTER]
  393.           0.1 [ENTER]
  394.  
  395. Next
  396. Branch Number 3 ?
  397.  
  398. Press
  399.           [Induc]
  400.  
  401. Inductor Value?
  402. Type
  403.           .3 [ENTER]
  404. Nodes L+.E-?
  405. Type
  406.           1 [ENTER]
  407.  
  408. Next
  409. Branch Number 4 ?
  410.  
  411. Press
  412.           [Resis]
  413.  
  414. Resistance Value ohms ?
  415.  
  416. Type
  417.           4 [ENTER]
  418. Nodes L+.E-?
  419. Type
  420.           1.2 [ENTER]            Node 2.1 would also work.
  421.  
  422. Next
  423. Branch Number 5 ?
  424.  
  425. Press
  426.           [Cap]
  427.  
  428. Capacitor value?
  429. Type
  430.           1 [EEX] 6 [+/-] [ENTER]
  431. Nodes L+.E-?
  432. Type
  433.           2 [ENTER]
  434.  
  435. Next
  436. Branch Number 6 ?
  437.  
  438. Press
  439.           [Resis]
  440.  
  441. Resistance Value ohms ?
  442.  
  443. Type
  444.           3 [ENTER]
  445. Nodes L+.E-?
  446. Type
  447.           2.3 [ENTER]            Node 3.2 would also work.
  448.  
  449. Branch Number 7 ?
  450.  
  451. Press
  452.           [Induc]
  453.  
  454. Inductor Value?
  455. Type
  456.           .2 [ENTER]
  457. Nodes L+.E-?
  458. Type
  459.           3 [ENTER]
  460.  
  461. Branch Number 8 ?
  462.  
  463. At This point choose [SOLV] to calculate voltages for each node.
  464.  
  465. Type
  466.           [NXT] [SOLV]
  467. [NXT] - Gets the second set of softkeys
  468. [SOLV] - Softkey in custom menu.  Solves for voltages
  469.  
  470. Solution for F=10000 Hz
  471. V1: (16.443864352  <-15.8963542449)
  472. V2: (15.9490964551 <-29.9869000426)
  473. V3: (15.9490960007 <-29.973221683 )
  474.  
  475. Solution for F=60 Hz
  476. V1: (46.18620388  <146.868)
  477. V2: (46.02842193 <149.8078)
  478. V3: (45.99203034 <152.0863 )
  479.  
  480.  
  481. Bug reports and suggestions are welcome.  This program is also available for th.
  482.  
  483.  
  484.  
  485. %%HP: T(3)A(D)F(.);
  486. DIR
  487.   To 0
  488.   Fr 3
  489.   X
  490. (0,-7.95774715457E-5)
  491.   CST { Resis Cap
  492. Inductor Is Vs&R
  493. IcIs VcIs R&Xj Solv
  494. Begin DELv }
  495.   F 10000
  496.   Dev
  497. "Br=7 Inductor
  498. .2 h:3:0"
  499.   Bn 8
  500.   C
  501. [[ (15.8150381166,-4.50391431966) ]
  502.  [ (13.8141456164,-7.97139000577) ]
  503.  [ (13.8160478582,-7.96809166731) ]]
  504.   B
  505. [[ (.5,.866025403784) ]
  506.  [ (0,0) ]
  507.  [ (0,0) ]]
  508.   A
  509. [[ (.250001,-5.30516476974E-5) (-.25,0) (0,0) ]
  510.  [ (-.25,0) (.583333333333,6.28318530718E-2) (-.333333333333,0) ]
  511.  [ (0,0) (-.333333333333,0) (.333333333333,-7.95774715457E-5) ]]
  512.   N 3
  513.   Begin
  514.     \<< CLLCD
  515. "    NFAP (c) 1990"
  516. 1 DISP
  517. "     Nodal Format"
  518. 3 DISP
  519. "   Analysis Program"
  520. 4 DISP
  521. "   By Don Robinson"
  522. 6 DISP { } MENU -40
  523. CF 2 5
  524.       FOR j j CF
  525.       NEXT 1 SF
  526. DELv CLEAR
  527. "Number Nodes?" ""
  528. INPUT OBJ\-> 'N' STO
  529. { N N } (0,0) CON
  530. 'A' STO { N 1 }
  531. (0,0) CON DUP 'B'
  532. STO 'C' STO 0 'Bn'
  533. STO "NONE" 'Dev'
  534. STO "Frequency Hz?"
  535. "" INPUT OBJ\-> 'F'
  536. STO Branch
  537.     \>>
  538.   DELv
  539.     \<< 'A' PURGE 'B'
  540. PURGE 'C' PURGE 'F'
  541. PURGE 'N' PURGE
  542. 'CST' PURGE 'Fr'
  543. PURGE 'Y' PURGE 'X'
  544. PURGE 'Bn' PURGE
  545. 'To' PURGE 'Dev'
  546. PURGE '\Gb' PURGE
  547. 'To2' PURGE 'Fr2'
  548. PURGE
  549.       IF 1 FC?C
  550.       THEN UPDIR
  551. CLLCD
  552.       END
  553.     \>>
  554.   Solv
  555.     \<< CLLCD CLEAR
  556. "Calculating" 1
  557. DISP B A / 'C' STO
  558. TEXT 0 STD 1 N
  559.       FOR j C j GET
  560. "V" j \->STR + \->TAG
  561.       NEXT 4 ENG
  562.     \>>
  563.   VcIs
  564.     \<< "VcIs
  565. " Brn
  566. "
  567. Voltage Control gm?"
  568. + "" INPUT OBJ\-> DUP
  569. 'X' STO "gm" LblD
  570. "
  571. Vx " + 3 SF From
  572. LblF "
  573. Is " + 3 SF
  574. 2 SF From LblG Add3
  575.     \>>
  576.   R&Xj
  577.     \<< "R+Xj
  578. " Brn
  579. "
  580. Resistance Value \GW?"
  581. + "" INPUT OBJ\-> DUP
  582. INV 'X' STO "\GW"
  583. LblD
  584. "
  585. Impedance Value (Xj)?"
  586. + "" INPUT OBJ\-> DUP
  587. X SWAP 2 * \pi \->NUM *
  588. F * INV NEG R\->C 'X'
  589. STO "Xj" LblD From
  590. LblF Add
  591.     \>>
  592.   Branch
  593.     \<<
  594.       IF 4 FC?C
  595.       THEN CLLCD
  596. "    NFAP (c) 1990"
  597. 1 DISP "Last: " Dev
  598. + 2 DISP STD 1 'Bn'
  599. STO+
  600. "  Branch Number "
  601. Bn \->STR + " ?" + 5
  602. DISP
  603. "   (Select Device)"
  604. 7 DISP Menu1 1 MENU
  605. 3 FREEZE
  606.       END
  607.     \>>
  608.   From
  609.     \<<
  610.       IF 3 FC?C
  611.       THEN "
  612. " +
  613.       END
  614. "Node L+.E-?" + ""
  615. INPUT OBJ\-> DUP IP
  616.       IF 2 FS?
  617.       THEN 'Fr2'
  618.       ELSE 'Fr'
  619.       END STO FP N
  620. LOG IP 1 + ALOG *
  621.       IF 2 FS?C
  622.       THEN 'To2'
  623.       ELSE 'To'
  624.       END STO
  625.     \>>
  626.   Brn
  627.     \<< Offm "Br=" Bn
  628. \->STR + " " + SWAP +
  629. DUP 'Dev' STO
  630.     \>>
  631.   Offm
  632.     \<< { } MENU
  633.     \>>
  634.   Menu1
  635.     \<< { Resis Cap
  636. Inductor Is Vs&R
  637. IcIs VcIs R&Xj Solv
  638. Begin DELv } MENU
  639.     \>>
  640.   Resis
  641.     \<< "Resistor
  642. "
  643. Brn
  644. "
  645. Resistance Value \GW?"
  646. + "" INPUT OBJ\-> DUP
  647. INV 0 R\->C 'X' STO
  648. "\GW" LblD From LblF
  649. Add
  650.     \>>
  651.   Cap
  652.     \<< "Capacitor
  653. "
  654. Brn
  655. "
  656. Capacitor Value?"
  657. + "" INPUT OBJ\-> DUP
  658. 0 SWAP F * 2 * \pi
  659. \->NUM * R\->C 'X' STO
  660. "f" LblD From LblF
  661. Add
  662.     \>>
  663.   Inductor
  664.     \<< "Inductor
  665. "
  666. Brn
  667. "
  668. Inductor Value?"
  669. + "" INPUT OBJ\-> DUP
  670. 0 SWAP 2 * F * \pi
  671. \->NUM * -1 SWAP /
  672. R\->C 'X' STO "h"
  673. LblD From LblF Add
  674.     \>>
  675.   Is
  676.     \<< "I\<)\Gh
  677. " Brn
  678. "
  679. Current Source I\<)\Gh?"
  680. + "" INPUT OBJ\-> DUP
  681. 'X' STO "" LblD
  682. From LblF Add2
  683.     \>>
  684.   Vs&R
  685.     \<< "Vs+R
  686. " Brn
  687. "
  688. Voltage Source (E\<)\Gh)?"
  689. + "" INPUT OBJ\-> DUP
  690. 'X' STO "E" LblD
  691. "
  692. Resistance \GW ?" +
  693. "" INPUT OBJ\-> DUP
  694. INV DUP 'Y' STO X *
  695. 'X' STO \->STR "\GW:" +
  696. Dev SWAP + DUP
  697. 'Dev' STO From LblF
  698. DUP 4 SF Add2 Y 'X'
  699. STO Add
  700.     \>>
  701.   IcIs
  702.     \<< "IcIs
  703. " Brn
  704. "
  705. Resistance Value \GW?"
  706. + "" INPUT OBJ\-> DUP
  707. INV 'Y' STO "\GW"
  708. LblD
  709. "
  710. Contol factor (\Gb)?"
  711. + "" INPUT OBJ\-> DUP
  712. '\Gb' STO "\Gb" LblD
  713. "
  714. R " + 3 SF From
  715. LblF Y 0 R\->C 'X'
  716. STO 4 SF Add Dev
  717. "
  718. Is " + 2 SF 3 SF
  719. From LblG \Gb Y * 0
  720. R\->C 'X' STO Add3
  721.     \>>
  722.   Add
  723.     \<< CLLCD 1 DISP
  724. "    Adding To Mat"
  725. 4 DISP 3 FREEZE
  726.       IF Fr 0 \=/
  727.       THEN A { Fr
  728. Fr } GET X + A { Fr
  729. Fr } ROT PUT 'A'
  730. STO
  731.       END
  732.       IF Fr 0 \=/
  733.       THEN
  734.         IF To 0 \=/
  735.         THEN A { To
  736. Fr } GET X - A { To
  737. Fr } ROT PUT 'A'
  738. STO A { Fr To } GET
  739. X - A { Fr To } ROT
  740. PUT 'A' STO
  741.         END
  742.       END
  743.       IF To 0 \=/
  744.       THEN A { To
  745. To } GET X + A { To
  746. To } ROT PUT 'A'
  747. STO
  748.       END Branch
  749.     \>>
  750.   Add2
  751.     \<< CLLCD 1 DISP
  752. "    Adding To Mat"
  753. 4 DISP 3 FREEZE
  754.       IF Fr 0 \=/
  755.       THEN B Fr GET
  756. X - B Fr ROT PUT
  757. 'B' STO
  758.       END
  759.       IF To 0 \=/
  760.       THEN B To GET
  761. X + B To ROT PUT
  762. 'B' STO
  763.       END Branch
  764.     \>>
  765.   Add3
  766.     \<< CLLCD 1 DISP
  767. "    Adding To Mat"
  768. 4 DISP 3 FREEZE
  769.       IF Fr2 0 \=/
  770.       THEN
  771.         IF Fr 0 \=/
  772.         THEN A {
  773. Fr2 Fr } GET X + A
  774. { Fr2 Fr } ROT PUT
  775. 'A' STO
  776.         END
  777.         IF To 0 \=/
  778.         THEN A {
  779. Fr2 To } GET X - A
  780. { Fr2 To } ROT PUT
  781. 'A' STO
  782.         END
  783.       END
  784.       IF To2 0 \=/
  785.       THEN
  786.         IF Fr 0 \=/
  787.         THEN A {
  788. To2 Fr } GET X - A
  789. { To2 Fr } ROT PUT
  790. 'A' STO
  791.         END
  792.         IF To 0 \=/
  793.         THEN A {
  794. To2 To } GET X + A
  795. { To2 To } ROT PUT
  796. 'A' STO
  797.         END
  798.       END Branch
  799.     \>>
  800.   LblD
  801.     \<< SWAP \->STR Dev
  802. SWAP + " " + SWAP +
  803. ":" + DUP 'Dev' STO
  804.     \>>
  805.   LblF
  806.     \<< Dev Fr \->STR +
  807. ":" + To \->STR + DUP
  808. 'Dev' STO
  809.     \>>
  810.   LblG
  811.     \<< Dev ":" + Fr2
  812. \->STR + ":" + To2
  813. \->STR + DUP 'Dev'
  814. STO
  815.     \>>
  816.   Copyright
  817.     \<<
  818. "V1.0 May 18,1990
  819. (c) Copyright
  820. Don C Robinson
  821. (913)362-3969hm
  822. (816)854-5243wk"
  823.     \>>
  824. END
  825.